package com.imut.hcdp.controller;

import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.imut.hcdp.domain.HcdpOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.imut.hcdp.common.Rst;
import com.imut.hcdp.domain.HcdpPassenger;
import com.imut.hcdp.service.IHcdpPassengerService;



@RestController
@RequestMapping("/system/passenger")
public class HcdpPassengerController
{
    @Autowired
    private IHcdpPassengerService hcdpPassengerService;


    /**
     * 我的行程
     * @param hcdpPassenger
     * @param request
     * @return
     */
    @GetMapping("/list")
    public Rst list(HcdpPassenger hcdpPassenger, HttpServletRequest request)
    {
//        String pageNum = request.getParameter("pageNum");
//        String pageSize = request.getParameter("pageSize");
//        PageHelper.startPage(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
        List<HcdpPassenger> list = hcdpPassengerService.selectHcdpPassengerList(hcdpPassenger);
//        PageInfo<HcdpPassenger> pageInfo = (PageInfo<HcdpPassenger>)list;
        return Rst.success(list);
    }





    @GetMapping(value = "/{id}")
    public Rst getInfo(@PathVariable("id") Long id)
    {
        return Rst.success(hcdpPassengerService.selectHcdpPassengerById(id));
    }




    @PostMapping
    public Rst add(@RequestBody HcdpPassenger hcdpPassenger)
    {
        return Rst.success(hcdpPassengerService.insertHcdpPassenger(hcdpPassenger));
    }




    @PutMapping
    public Rst edit(@RequestBody HcdpPassenger hcdpPassenger)
    {
        return Rst.success(hcdpPassengerService.updateHcdpPassenger(hcdpPassenger));
    }




	@DeleteMapping("/{ids}")
    public Rst remove(@PathVariable Long[] ids)
    {
        return Rst.success(hcdpPassengerService.deleteHcdpPassengerByIds(ids));
    }
}
